home *** CD-ROM | disk | FTP | other *** search
/ PC Format (UK) 188 / 01-04 PC Format 188 [2006-06] DVD side 1_.iso / Menus / Scenes / HOME.dir / 00003_Script_GenerateDock Script < prev    next >
Text File  |  2006-04-20  |  3KB  |  143 lines

  1. global dock
  2. global mKey
  3. global mp
  4. global dv
  5.  
  6.  
  7. on populateDockCast
  8.   repeat with i = 1 to castlib(2).member.count
  9.     member(i,2).erase()
  10.   end repeat
  11.   
  12.   repeat with i = 1 to castlib("tabs").member.count
  13.     member(i, "tabs").erase()
  14.   end repeat
  15.   
  16.   
  17.   repeat with i = 1 to (mKey.count)
  18.     ok = baFileExists(mKey[i].pPath & "icon.png")
  19.     if ok = 1 then
  20.       
  21.       nm = new(#bitmap, castlib("dock"))
  22.       nm.importfileinto(mKey[i].pPath & "icon.png")
  23.       nm.name = string(mKey[i].pTitle)
  24.       
  25.       
  26.       nTab = new(#bitmap, castlib("tabs"))
  27.       nTab.importfileinto(mKey[i].pPath & "tab.png")
  28.       nTab.name = string(mKey[i].pTitle)
  29.       nTab.regpoint = point(0,0)
  30.       
  31.     else
  32.       alert("No Icon found for " & mKey[i].pTitle & " in:  " & mKey[i].pPath)
  33.       quit
  34.     end if
  35.     
  36.   end repeat
  37. end
  38.  
  39.  
  40. on resetSectionTitle
  41.   member("Section_Title").text = "Home"
  42. end
  43.  
  44. on generateDock
  45.   dock = [:]
  46.   dock[#bWidth] = 50
  47.   dock[#fullWidth] = 80
  48.   dock[#widthDif] = dock.fullWidth - dock.bWidth
  49.   dock[#bc] = castlib("dock").member.count
  50.   dock[#baseWidth] = (dock.bWidth + (dock.bWidth * 2)) * dock.bc
  51.   dock[#DistList] = []
  52.   dock[#ClosestSp] = 0
  53.   dock[#mPos] = vector(0,0,0)
  54.   dock[#minDist] = 100
  55.   dock[#BiggestBut] = dock.bc / 2
  56.   dock[#OffsetVal] = dock.bWidth * 2
  57.   
  58.   repeat with i = 1 to castlib(3).member.count
  59.     member(i,3).erase()
  60.   end repeat
  61.   
  62.   repeat with i = 1 to _movie.channel.count
  63.     if sprite(i).member = member("DockPlaceholder") then
  64.       dock[#StartChannel] = i + 1
  65.       sprite(i).visible = false
  66.       dock[#BaseV] = sprite(i).locV
  67.       exit repeat
  68.     end if 
  69.   end repeat
  70.   
  71.   repeat with i = dock.startchannel to _movie.channel.count
  72.     sprite(i).scriptinstancelist = []
  73.     channel(i).removescriptedsprite()
  74.   end repeat
  75.   
  76.   sCen = (the stageright - the stageLeft) / 2
  77.   dock[#lPoint] = (sCen - (dock.baseWidth / 4))
  78.   chn = 400
  79.   lh = dock.lPoint
  80.   lv = dock.baseV
  81.   ratio = float(dock.bWidth / member(1, "dock").width)
  82.   
  83.   repeat with i = 1 to dock.bc
  84.     mKey[i][#DockSp] = sprite(chn)
  85.     pos = point(lh, lv)
  86.     mem = member(i, "dock")
  87.     channel(chn).makescriptedsprite(mem, pos)
  88.     sc = script("DockHandler").new()
  89.     sprite(chn).scriptInstanceList.add(sc)
  90.     sendsprite(chn, #init, pos, i, mKey[i][#pPath], chn)
  91.     chn = chn + 1
  92.     tm = new(#text, castlib 3 )
  93.     tm.fontsize = 18
  94.     tm.fontstyle = [#bold]
  95.     tm.width = dock.bWidth * 2
  96.     tm.antialias = true
  97.     tm.antialiasthreshold = 0
  98.     tm.alignment = #center
  99.     tm.text = member(i, "dock").name
  100.     tm.color = rgb(255,255,255)
  101.     tpos = point(lh + (tm.Width / 4), (lv + (dock.bWidth / 2)))
  102.     channel(chn).makescriptedsprite(tm, tpos)
  103.     sprite(chn).ink = 6
  104.     lh = lh + dock.OffsetVal
  105.     chn = chn + 1
  106.   end repeat
  107. end
  108.  
  109. on upDateDock
  110.   
  111.   if the mouseV > 400 then
  112.     Sel = min(Dock.DistList)
  113.     repeat with i = 1 to dock.distList.count
  114.       if Dock.distList[i] = sel then
  115.         Dock.BiggestBut = i
  116.         exit repeat
  117.       end if
  118.     end repeat
  119.   end if
  120.   
  121. end
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.